export default {
  components: {},
  props: ["value"],
  data() {
    return {
      min: "",
      max: "",
    };
  },
  created() {},
  mounted() {},
  watch: {
    value: {
      handler(newVal) {
        if (Array.isArray(newVal)) {
          this.min = newVal[0];
          this.max = newVal[1];
        }
      },
      immediate: true,
    },
  },
  computed: {},
  methods: {
    handleInput(type) {
      return (e) => {
        if (type == "min") {
          this.$emit("input", [e, this.max]);
        } else {
          this.$emit("input", [this.min, e]);
        }
      };
    },
  },
  render() {
    return (
      <div style="display: inline-block">
        <el-input placeholder="请输入最小值" style="width: 150px" value={this.min} onInput={this.handleInput('min')} />
        <span> - </span>
        <el-input placeholder="请输入最大值" style="width: 150px" value={this.max} onInput={this.handleInput('max')} />
      </div>
    );
  },
};